<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    //传统方式定义方法
    const person1={
        sayHi:function (){
            console.log("Hi");
        }
    }
    //调用
    person1.sayHi();

    //es6
    const person2={
        sayHi(){
            console.log("Hi");
        }
    }
    person2.sayHi();
</script>
</html>